-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add new routes and features for ticket and flag management (CRUD api) #15
Conversation
@Valimp the pre-commit hook is failing, can you update it by using the one from Open prices? https://github.com/openfoodfacts/open-prices/blob/main/.pre-commit-config.yaml |
I'm going to fix that thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! I've added my feedback :)
You should also add integration tests, you can look at open-prices repo to see how it's done!
|
||
|
||
# Get all flags (one to many relationship) | ||
@app.get("/flags") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's okay for a first version, but we should quickly add pagination
app/models.py
Outdated
) | ||
|
||
db = PostgresqlDatabase( | ||
"postgres", user="postgres", password="postgres", host="postgres", port=5432 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use envvar instead of hardcoded values, you can add declare them in config.Settings. Make sure they are defined in docker-compose.yml (in the environment section), otherwise docker doesn't pass the envvar to the container
@Valimp you wrote a nice description to this PR, it's a pity it's not in any /docs folder in the project. Here it's lost. Could you put it in some file ? |
Docker compose
Add postgres
Models
Add models for posgres tables "flags", "tickets", "moderator_actions"
Flag Creation Endpoint:
Flag Creation Endpoint:
Added a new endpoint (/flags) for creating flags, representing a one-to-one relationship with tickets. This feature allows users to report issues related to a product, providing details such as barcode, type of issue, user ID, device ID, source, confidence, image ID, flavour, reason, and comments.
Flag Retrieval Endpoint:
Flag Retrieval Endpoint:
Implemented a new endpoint (/flags) to retrieve all flags, showcasing the one-to-many relationship between flags and tickets. Users can view a list of reported issues along with their associated details.
Ticket Status Update Endpoint:
Ticket Status Update Endpoint:
Introduced an endpoint (/tickets/{ticket_id}/status) to update the status of a ticket. Users can now change the status of a ticket to either "open" or "closed," representing a soft delete mechanism.
Some other Endpoints
GET all flags or tickets (/flags) / (/tickets)
GET flags or tickets by id (/flags/{id}) / (/tickets/{id})
Hard DELETE flags or tickets by id (/flags/{id}) / (/tickets/{id})
Mention : @raphael0202